#ifndef SCENE_H
#define SCENE_H

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include "vector.h"
#include "sphere.h"
#include "simplesurface.h"
#include "ppmcanvas.h"
#include "ray.h"


typedef struct {
  ObjectRel *objects;
  Vector *lightPoints;
  Vector position,
    lookingAt;
  double fieldOfView;
  int recursionDepth;
} Scene;

typedef struct {
  Sphere o;
  double t;
  SimpleSurface s;
} Intersection;


typedef struct {
  Sphere sphere;
  SimpleSurface surface;
} ObjectRel;


double firstIntersection(double *intersections);
void moveTo(Scene s, Vector p);
void lookAt(Scene s, Vector p);
void addObject(Scene s, ObjectRel or);
void addLight(Scene s, Vector l);
void render(Scene s, PpmCanvas canvas);
Vector rayColour(Scene s, Ray r);
bool _lightIsVisible(Scene s, Vector l, Vector p);
Vector * visibleLights(Scene s, Vector p);

#endif
